<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="persistence.PerformanceVO"%><%@page import="persistence.PerformanceEngineDAO"%><head>	<link rel="stylesheet" href="css/demos.css" media="screen" type="text/css">	<script type="text/javascript" src="dhtml-suite.js"></script></head>
<body><% 		java.util.List<PerformanceVO> lsPerformance = (new PerformanceEngineDAO()).listPerformance(request.getParameter("date"));%>
<div><table id="performance">	<thead>		<tr>			<td>date</td>			<td>stock</td>			<td>status</td>			<td>book</td>			<td>buy</td>			<td>stoploss</td>			<td>limit</td>			<td>price curr</td>			<td>gain/loss</td>			<td></td>		</tr>	</thead>	<tbody>
<%	for(int x=0; x<lsPerformance.size(); x++) { 			PerformanceVO vo = lsPerformance.get(x);			if(vo.getType() != 1) 				continue;			String status = (vo.getBuysell() == 1) ? "buy" : "sell";			double buy = Double.parseDouble(vo.getPbuy());			double close = Double.parseDouble(vo.getPriceCurr());			double gainloss = (close > buy) ? ((close / buy)*100)-100 : -(((buy / close)*100)-100);		    String color = (gainloss<0) ? "#FA8686" : "#AED2FB"; 
%>	
		<tr onclick="changeTicker('<%=vo.getDate()%>','<%=vo.getStock()%>','<%=status%>','<%=vo.getBook()%>','<%=vo.getPbuy()%>','<%=vo.getPstoploss()%>','<%=vo.getPlimit()%>','<%=vo.getPriceCurr()%>')">			<td><%=vo.getDate()%></td> 			<td><%=vo.getStock()%></td>			<td><%=status%></td>			<td><%=vo.getBook()%></td>			<td><%=vo.getPbuy()%></td>			<td><%=vo.getPstoploss()%></td>			<td><%=vo.getPlimit()%></td>			<td><%=vo.getPriceCurr()%></td>			<td style="background-color:<%=color%>;"><center><b><%=(new java.text.DecimalFormat("##0.00")).format(gainloss)%>%</b></center></td>			<td><img src="delete.gif" onclick="<%=vo.getId()%>"></td> 		</tr><% } %>	</tbody>
</table></div>
<script type="text/javascript">
var tableWidgetObj_demo2 = new DHTMLSuite.tableWidget();tableWidgetObj_demo2.setTableId('performance');tableWidgetObj_demo2.setTableWidth(700);tableWidgetObj_demo2.setTableHeight(230);tableWidgetObj_demo2.setColumnSort(Array('S','S','S','N','N','N','N','N'));tableWidgetObj_demo2.init();
//tableWidgetObj_demo2.sortTableByColumn(1);// Initially sort the table by the second column</script><br></body>
</html>